table.FIELDS_GET Function

Syntax

Number_of_Fields as N = Fields_Get()

Description

Returns the number of fields in a record for the table referenced by <TBL>. The FIELDS_GET() method is most useful when you do not know much about the table you are using. After determining the Number_of_Fields available, you can then get an object pointer to each field in the table using the <TBL>.FIELD_GET() method.

Example

This script opens the Customer table, displays the number of fields in each record, and then prints a list of the field names in the Trace window.

dim tbl as P
tbl = table.open("c:\a5\a_sports\customer.dbf")
field_count = tbl.fields_get()
trace.writeln("Fields in table:" + STR(field_count))
for i = 1 TO field_count
    fld = tbl.field_get(i)
    trace.writeln(fld.name_get())
NEXT I
tbl.close()

See Also